Format of RS232 Results

In case of the RS232 (or RS422) interface, the SrvHo Server can send results in two formats:

  • Binary

  • ASCII

There is no need to care about the data format if you use HomSoft and do not want to control or monitor the Homer using your own program.

Binary Results Format

Binary format is the standard, compact format for efficient and fast transmission of results, using the smallest possible number of bytes. The format is described in detail in Homer Communication Protocol. A block of bytes containing encoded results of one measurement is termed Measurement Data Object (MDO). To arrive at actual results, you have to decode MDO using a few simple formulas.

ASCII Results Format

If you do not need to send commands to the Homer but only wish to receive results without having to decode binary byte streams, you can choose ASCII results format. Note that this applies only to RS232 (RS422), not CAN Bus. Although slightly slower than binary, the results come in open form of readable ASCII strings.

To start SrvHo running in ASCII mode, proceed as described in topic Choosing Homer Power-up Server and press A when selecting Server.

SrvHo running in ASCII mode announces itself by playing RSA Morse code | × - × | × × × | × - | at the start.

Then (if the Homer is configured to measure and transmit data automatically – controlled by Autorun line in Hom.cfg file) your COM port monitor shows results strings, each of which may include labels:

Clk=50736732 HST=20 HER=16 MHz=915 Mag=0.928 Deg=34.127 Mgd=NONE Dgd=NONE Pi=7.376E3 Pr=6.349E3 T=25.1 M1=5000 M2=5000 M3=0 MS1=119 MS2=0 END

or be without labels:

50736732 20 16 915 0.928 34.127 NONE NONE 7.376E3 6.349E3 25.1 5000 5000 0 119 0

These are results in open, readable form. The first, lengthier form, has the advantage of identifying the particular results by a label (e.g., Mag=0.928, which means that magnitude of input reflection coefficient is 0.928). The general form of the string is

[Name1=]Value1<Delim>[Name2=]Value2<Delim> … [NameN=]ValueN<Delim>[END]<CRLF>

where

NameN is a label, defining item type

ValueN is corresponding numerical value

<Delim> is delimiter, separating items of the string

<CRLF> is two-byte combination Carriage Return CR + Line Feed LF (bytes 10, 13)

The entities in square brackets are optional.

The string starts with time information

[Clk=]MeaFinishTick_ms

which is internal computer tick in milliseconds taken at the moment when a measurement finished.

The format of the string is controlled by the following lines in the internal Hom.cfg configuration file:

Asc_Delim=32          ;Delimiter of ASCII results: code of delimiting char

Asc_UseLabels=TRUE    ;Use labels XXX= in ASCII results

Asc_InvalStr=NONE     ;Padding string to substitute invalid/not present results

Asc_Delim: Delimiter

Asc_Delim line defines ASCII code of the delimiting character (0 to 255 with the exceptions below) or the character itself. The rules are as follows:

  • If Asc_Delim=10 or 13, the actual delimiter will be the two-byte <CRLF> combination (10, 13).

  • The delimiter cannot be:

  • a character used for representation of numbers (0 to 9, +, -, e, E)

  • equality sign (=)

  • semicolon (;)

  • left square bracket ([)

In these cases the default delimiter space (ASCII code 32) will be used.

If Asc_Delim line is missing in Hom.cfg, the default delimiter space (ASCII code 32) is used.

Examples:

Asc_Delim=59          ;result=59 (semicolon)

Asc_Delim=;           ;result=59 (semicolon)

Asc_Delim=13          ;result=13 (CR, actual delimiter will be CR+LF)

Asc_Delim=Newline     ;result=10 (LF, actual delimiter will be CR+LF)

Asc_Delim=Tab         ;result=9 (tab).

Asc_Delim=Ta          ;error: result=32 (space)

Asc_Delim=1236        ;error (more than 255): result=32 (space)

Asc_Delim=+           ;error (numeric char): result=32 (space)

Asc_Delim==           ;error (equality sign): result=32 (space)

Asc_UseLabels: Labels

If Asc_UseLabels=TRUE:

  • The labels (followed by equality signs) are present in the results string.

  • The terminating <CRLF> is preceded by “END” substring.

If Asc_UseLabels=FALSE:

  • The results string consists of only numerical data separated by delimiter.

  • There is no “END” substring.

  • If delimiter is Tab, this form is useful for import to Microsoft Excel (especially by copy and paste method Ctrl+C, Ctrl+V).

If Asc_UseLabels line is missing in Hom.cfg, the default TRUE is used.

Asc_InvalStr: Invalid Result Substitution

Asc_InvalStr line defines a padding string (up to 15 characters long) that will be sent when a particular result is invalid or not present (e.g., sometimes only motor positions without Analyzer data are sent). To avoid the shifting of particular results to different positions in the results string, this padding string is used for the missing data. It can be “0”, “none”, “n.a.” etc.

If Asc_InvalStr is empty, the invalid or missing results will not be represented in the results string at all.

If Asc_InvalStr line is missing, the default “NONE” padding string is used.

Examples:

A case with padding string “X”

Asc_InvalStr=X

 

Clk=0 HST=16 HER=0 MHz=X Mag=X Deg=X Mgd=X Dgd=X Pi=X Pr=X T=X M1=320 M2=320 M3=0 MS1=71 MS2=0 END

The same results with empty Asc_InvalStr

Asc_InvalStr=

 

Clk=0 HST=16 HER=0 M1=320 M2=320 M3=0 MS1=71 MS2=0 END

In the latter case the bold-printed substring from the first example is missing.